package org.hnxxxy.ebms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @Description:
 * @Author WANGWEI
 * @Date: 2021/6/8  21:12
 * @EMAIL: 1377366738@qq.com
 */
@SpringBootApplication
public class EbmsApplication {

  public static void main(String[] args) {
    boolean isTest = isTest(args);

    SpringApplication app = new SpringApplication(EbmsApplication.class);
    // 启动dev配置文件
    if (isTest) {
      app.setAdditionalProfiles("test"); // 测试环境
    } else {
      app.setAdditionalProfiles("dev"); // 默认开发环境
    }
    app.run();
  }

  protected static boolean isTest(String[] args) {
    // --spring.profiles.active=prod
    for (String arg : args) {
      if ("--spring.profiles.active=test".equals(arg)) {
        return true;
      }
    }
    return false;
  }

}
